package br.ufrgs.tst.ga.model;

import java.security.InvalidParameterException;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

import br.ufrgs.ga.model.GeneticModelFactory;
import br.ufrgs.ga.model.IChromosome;

public class TestGeneticModelFactory {

	private static final String DNA_STRAND_VALUE = "012345";
	private static final String INVALID_DNA_STRAND_VALUE = "01235";
	private GeneticModelFactory factory;
	
	@Before
	public void setUp() {
		factory = GeneticModelFactory.getInstance();
	}
	
	@Test
	public void createChromosomeTest() {
		IChromosome<String> chromosome = factory.createChromosome(DNA_STRAND_VALUE);
		
		Assert.assertNotNull(chromosome);
		Assert.assertEquals(DNA_STRAND_VALUE, chromosome.getDnaStrand());
		
		IChromosome<String> chromosome2 = null;
		try {
			chromosome2 = factory.createChromosome(INVALID_DNA_STRAND_VALUE);
		} catch (InvalidParameterException e) {
			Assert.assertNull(chromosome2);
		}
	}
}
